 #!/bin/bash
echo "Which subdirectory would you like to convert the pictures in? EX: 'Cabaret', 'Student_Life', 'Photograyh'";
read dir;
dir="/var/www/DiMF/media/pictures/"${dir};
##dir="/home/jex/TEST/"${dir};
echo "Are you sure you want to convert the pictures in ${dir} to video? This may take a few minutes. (y/n)";
read ans;
if [[ $ans =~ "y" ]]
then
	
	echo "How long do you want to display pictures for? (In seconds)"
	read time;
	cd $dir;
	name=$(date +%m-%d-%y_%T);
	ffmpeg -r "1/${time}" -f image2 -i IMG_%04d.jpg -r 25 -y -an ${name}.mpg
	echo "Conversion finished.";
	mv ${name}.mpg "/var/www/DiMF/media/slideshow/"${name}".mpg" ;
	echo "File Moved : /var/www/DiMF/media/slideshow/${name}.mpg" ;
	
else 
	echo "Aborting..." ;
fi
echo "Exiting..."
